package meta.api.web.file.presentation.form;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import meta.common.util.ListUtil;
import meta.common.util.StrUtil;

/**
 * 元数据Form
 */
public class MetadataForm implements Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     * 名
     */
    @JsonProperty(value = "metadata.name")
    private String name;

    /**
     * 标签字符串
     */
    @JsonIgnore
    private String tags;

    /**
     * 标签列表
     */
    @JsonProperty(value = "metadata.tags")
    private List<String> tagList;

    /**
     * 是否共享
     */
    @JsonProperty(value = "metadata.shared")
    private Boolean shared;

    /**
     * 目录
     */
    @JsonProperty(value = "metadata.directory")
    private String directory;

    /**
     * 备注
     */
    @JsonProperty(value = "metadata.remarks")
    private String remarks;

    /**
     * 文件类型
     */
    @JsonProperty(value = "metadata.type")
    private String type;

    /**
     * 图片名
     */
    @JsonProperty(value = "metadata.imageFilename")
    private String imageName;

    /**
     * 图片URL
     */
    @JsonProperty(value = "metadata.image")
    private String imageUrl;

    public void rebuildTags() {
        if (ListUtil.isNotEmptyList(this.tagList)) {
            this.tags = StrUtil.strLstAgg(this.tagList, ",");
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public List<String> getTagList() {
        return tagList;
    }

    public void setTagList(List<String> tagList) {
        this.tagList = tagList;
    }

    public Boolean getShared() {
        return shared;
    }

    public void setShared(Boolean shared) {
        this.shared = shared;
    }

    public String getDirectory() {
        return directory;
    }

    public void setDirectory(String directory) {
        this.directory = directory;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getImageName() {
        return imageName;
    }

    public void setImageName(String imageName) {
        this.imageName = imageName;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }
}
